package com.scaffold.myproject.web.xxljob;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class MyJobHandler {

    @XxlJob("demoJobHandler")
    public void demoJobHandler() throws Exception {
        // 从上下文中获取任务参数
        String param = XxlJobHelper.getJobParam();
        System.out.println("执行定时任务 demoJobHandler：" + LocalDateTime.now() + "  参数：" + param);
    }
}
